package com.alameda.service.impl.file;

import com.alameda.facade.file.MediaFileFacade;
import com.alameda.service.file.MediaFileService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 文件 业务逻辑层 具体实现
 *
 * @author Lv
 * @date 2024/11/24
 */
@Slf4j
@Service
public class MediaFileServiceImpl implements MediaFileService {

    @Autowired
    private MediaFileFacade mediaFileFacade;

    /**
     * 物理层面移除已逻辑删除文件
     *
     * @return
     */
    // todo MDC 内存删除问题 不同服务MDC删除
    @XxlJob("removeLogicDeletedFile")
    @Override
    public void removeLogicDeletedFile() {
        Boolean aBoolean = mediaFileFacade.removeLogicDeletedFile();
        log.info("物理层面移除已逻辑删除文件 :{}", aBoolean);
    }

    /**
     * 物理层面删除已逻辑删除超过七天的视频弹幕
     */
    @XxlJob("removeLogicDeletedFileDanmaku")
    @Override
    public void removeLogicDeletedFileDanmaku() {
        Boolean aBoolean = mediaFileFacade.removeLogicDeletedFileDanmaku();
        log.info("物理层面移除已逻辑删除视频文件弹幕 :{}", aBoolean);
    }
}
